import type { ApiPagination, ApiPaginationParams } from '#types/utils'
import { requestClient } from '../request'
import type { SiteItemForm, sitePageListItem } from './model/siteModel'

// 用户管理
export default class SysUserApi {
    static get inst() {
        return SysUserApi._inst || (SysUserApi._inst = new SysUserApi())
    }
    private static _inst: SysUserApi
    add(params: Partial<SiteItemForm>) {
        return requestClient.post<null>('/site/add', params)
    }
    delete(ids: Array<number | string>) {
        return requestClient.delete<null>(`/site/delete/${ids}`)
    }
    edit(id: number | string, params: Partial<SiteItemForm>) {
        return requestClient.put<null>(`/site/edit/${id}`, params)
    }
    /**
     * 站点管理分页
     * @param params
     */
    getPageList(params: ApiPaginationParams<{ username?: string }>) {
        return requestClient.get<ApiPagination<sitePageListItem>>('/site/index', {
            params
        })
    }
}
